//
//  SPCanvasView.h
//  SPMapKit
//
//  Created by zhangbo on 2017/9/8.
//  Copyright © 2017年 zhangbo. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "SPAnnotationView.h"
#import <MapKit/MapKit.h>
#import "SPOverlayRenderer.h"
#import "SPAnnotationView.h"

@protocol SPCanvasDelegate <NSObject>

-(SPAnnotationView*) viewForAnnotation:(id <SPAnnotation>)annotation;
-(CGPoint) GPSToScreenPosition:(CLLocationCoordinate2D) gpspoint;
-(SPOverlayRenderer *) rendererForOverlay:(id <SPOverlay>)overlay;

@end

@interface SPCanvasView : UIView
{
    NSMutableArray *_annotations;
    NSMutableArray *_overlays;
    
    NSMutableDictionary *_annotationViewCache;
    NSMutableDictionary *_overlayRenderCache;
}

@property(nonatomic, assign) CGFloat zoomScale;
@property(nonatomic, assign) CGPoint contentOffset;
@property(nonatomic, weak) id<SPCanvasDelegate> delegate;

-(void) addAnnotation:(id<SPAnnotation>) annotation;
-(void) removeAnnotation:(id<SPAnnotation>) annotation;
-(void) removeAllAnnotations;
-(void) addOverlay:(id<SPOverlay>) overlay;
-(void) removeOverlay:(id<SPOverlay>) overlay;
-(void) removeALLOverlays;

-(void) refresh;
-(void) refresh:(id<SPAnnotation>) annotation;
-(void) refreshOverlay;

-(NSMutableArray*) annotations;
-(NSMutableArray*) overlays;

-(SPAnnotationView*) getAnnotatioinView:(id<SPAnnotation>) annotation;
-(NSArray*) getOverlayScreenPointList:(id<SPOverlay>) overlay;

@end
